package com.example.demo.service;

import com.example.demo.mapper.AirQualityIndexMapper;
import com.example.demo.pojo.AirQualityIndex;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;
@Service
@Transactional
public class AirQualityIndexServiceImpl implements AirQualityIndexService {
    @Autowired
    AirQualityIndexMapper airQualityIndexMapper;
    @Override
    public List<AirQualityIndex> getAriQualityByContent(AirQualityIndex airQualityIndex) {
        return airQualityIndexMapper.selectAriQualityByContent(airQualityIndex);
    }

    @Override
    public int addAriQuality(AirQualityIndex airQualityIndex) {
        Date date=new Date();
        airQualityIndex.setLastmodifytime(date);
        return airQualityIndexMapper.insertAriQuality(airQualityIndex);
    }

    @Override
    public AirQualityIndex getAriQualityById(Integer id) {
        return airQualityIndexMapper.selectAriQualityById(id);
    }

    @Override
    public int changeAriQuality(AirQualityIndex airQualityIndex) {
        Date date=new Date();
        airQualityIndex.setLastmodifytime(date);
        return airQualityIndexMapper.updateAriQuality(airQualityIndex);
    }

    @Override
    public int removeAriQuality(int id) {
        return airQualityIndexMapper.deleteAriQuality(id);
    }
}
